using System;
using System.Collections.Generic;
using System.Text;

namespace WQ.Common
{
    public class BOOL
    {
        private bool m_bool = false;
        private string m_warning = "";
        public bool BoolValue
        {
            get { return m_bool; }
            set { m_bool = value; }
        }
        public string Warning
        {
            get { return m_warning; }
            set { m_warning = value; }
        }
        public BOOL()
        {

        }
        public BOOL(bool var)
        {
            m_bool = var;
            m_warning = "";
        }
        public static bool operator true(BOOL n)
        {
            return n.m_bool;
        }

        public static bool operator false(BOOL n)
        {
            return n.m_bool;
        }
        public static bool operator !(BOOL n)
        {
            return !n.m_bool;
        }
        public static bool operator ==(BOOL n,BOOL m)
        {
            if (n.BoolValue==m.BoolValue)
            {
                return true;
            } 
            else
            {
                return false;
            }
        }
        public static bool operator !=(BOOL n, BOOL m)
        {
            if (n.BoolValue == m.BoolValue)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        public override string ToString()
        {
            return this.m_warning;
        }
        public override bool Equals(object obj)
        {
            if (!(obj is BOOL))
                throw new ArgumentException("Argument not a BOOL", "obj");

            if (this.BoolValue == ((BOOL)obj).BoolValue)
            {
                return true;
            } 
            else
            {
                return false;
            }
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
        public bool ToBoolean()
        {
            return m_bool;
        }
    }
}
